#pragma once

#include "write.h"

namespace sfc::io {

struct Stdout : Write<Stdout> {
  static auto is_tty() -> bool;
  static auto get_column() -> usize;

  auto write(Slice<const u8> buf) -> usize;
  void flush();
};

struct Stderr : Write<Stdout> {
  auto write(Slice<const u8> buf) -> usize;
};

void print(const auto&... args) {
  auto w = Stdout{};
  fmt::write(w, args...);
}

void eprint(const auto&... args) {
  auto w = Stderr{};
  fmt::write(w, args...);
}

void println(const auto&... args) {
  auto w = Stdout{};
  fmt::writeln(w, args...);
}

void eprintln(const auto&... args) {
  auto w = Stderr{};
  fmt::writeln(w, args...);
}

}  // namespace sfc::io
